<?php
namespace Modules\Home\Services;

use Common\Models\UserModel;
use Common\Models\UserWalletModel;
use Common\Models\UserWalletGoodsLogModel;

class UserWalletGoodsLogService {
  public function create($parameter) {
    $userWalletGoodsLogModel = new UserWalletGoodsLogModel($parameter);
    try {
      if(!$userWalletGoodsLogModel -> create()) {
        $messages = $userWalletGoodsLogModel -> getMessages();
        return ['code' => -1, 'message' => $messages[0] -> getMessage()];
      }
    } catch(\Exception $e) {
      return ['code' => -1, 'message' => $e -> getMessage()];
    }

    return ['code' => 0, 'user_wallet_goods_log' => $userWalletGoodsLogModel];
  }
}
